package com.example.a10928.weifriend.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.a10928.weifriend.R;
import com.example.a10928.weifriend.http.api.base.RankBean;
import com.squareup.picasso.Picasso;

import java.util.List;

public class RecommonVipAdapter extends BaseQuickAdapter<RankBean.TodayRecommendRankingBean, BaseViewHolder> {

    public RecommonVipAdapter(int layoutResId,  List<RankBean.TodayRecommendRankingBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RankBean.TodayRecommendRankingBean item) {
        if (null == item.getUser_info()) return;
        Picasso.with(mContext).load(item.getUser_info().getUser_headimg()).into((ImageView) helper.getView(R.id.iv_header));

        helper.setText( R.id.tv_id,item.getUser_info().getUser_name())
                .setText(R.id.tv_value,item.getRecommend());


        switch (item.getRank()){
            case 0:

                helper.getView(R.id.iv_level).setBackgroundResource(R.drawable.level_1);
                break;
            case 1:
                helper.getView(R.id.iv_level).setBackgroundResource(R.drawable.level_2);
                break;
            case 2:
                helper.getView(R.id.iv_level).setBackgroundResource(R.drawable.level_3);
                break;
            case 3:
                helper.getView(R.id.iv_level).setBackgroundResource(R.drawable.level_4);
                break;
            case 4:
                helper.getView(R.id.iv_level).setBackgroundResource(R.drawable.level_5);
                break;

        }
    }
}
